﻿package mortal.game.scene3D.fight
{
    import Message.DB.Tables.*;
    import __AS3__.vec.*;
    import baseEngine.core.*;
    import com.gengine.utils.pools.*;
    import flash.geom.*;
    import mortal.game.manager.*;
    import mortal.game.scene3D.layer3D.utils.*;
    import mortal.game.scene3D.player.entity.*;

    public class FightEffectBase extends Object
    {
        protected var maxTime:int = 4000;
        private var _disposeDate:Date;
        protected var _attackId:int;
        protected var _fromPlayer:SpritePlayer;
        protected var _targetPlayer:SpritePlayer;
        protected var _isNotAutoShield:Boolean = false;
        protected var _isNotShildEffect:Boolean = false;
        protected var _hitPlayers:Vector.<SpritePlayer>;
        protected var _targetPoint:Point;
        protected var _skill:TSkill;
        protected var _callBack:Function;
        protected var _isFromRolePlayer:Boolean = false;
        protected var _isFinish:Boolean = true;

        public function FightEffectBase()
        {
            return;
        }// end function

        public function setCallBack(param1:Function) : void
        {
            this._callBack = param1;
            return;
        }// end function

        public function get layer() : Pivot3D
        {
            return EntityLayerUtil.getLayer();
        }// end function

        public function setAttackId(param1:int) : void
        {
            this._attackId = param1;
            return;
        }// end function

        public function setSkill(param1:TSkill) : void
        {
            this._skill = param1;
            return;
        }// end function

        public function setFromPlayer(param1:SpritePlayer) : void
        {
            this._fromPlayer = param1;
            this._isFromRolePlayer = param1 is RolePlayer;
            return;
        }// end function

        public function setTargetPoint(param1:Point) : void
        {
            this._targetPoint = param1;
            return;
        }// end function

        public function setTargetPlayer(param1:SpritePlayer) : void
        {
            this._targetPlayer = param1;
            return;
        }// end function

        public function setHitPlayers(param1:Vector.<SpritePlayer>) : void
        {
            this._hitPlayers = param1;
            return;
        }// end function

        public function runStart() : void
        {
            this._disposeDate = ClockManager.instance.getDelayDate(this.maxTime);
            ClockManager.instance.addDateCall(this._disposeDate, this.runFinish);
            this._isFinish = false;
            return;
        }// end function

        public function runFinish() : void
        {
            if (this._isFinish)
            {
                return;
            }
            if (this._disposeDate)
            {
                ClockManager.instance.removeDateCall(this._disposeDate);
            }
            if (this._callBack != null)
            {
                this._callBack.call(null, this._attackId);
            }
            this._isFinish = true;
            this.dispose();
            return;
        }// end function

        public function dispose() : void
        {
            this._disposeDate = null;
            this._attackId = 0;
            this._fromPlayer = null;
            this._targetPlayer = null;
            this._hitPlayers = null;
            this._targetPoint = null;
            this._skill = null;
            this._callBack = null;
            this._isFromRolePlayer = false;
            this._isNotAutoShield = false;
            this._isNotShildEffect = false;
            ObjectPool.disposeObject(this);
            return;
        }// end function

        public function get isNotAutoShield() : Boolean
        {
            return this._isNotAutoShield;
        }// end function

        public function set isNotAutoShield(param1:Boolean) : void
        {
            this._isNotAutoShield = param1;
            this._isNotShildEffect = FightEffectChecker.check(this._isNotAutoShield);
            return;
        }// end function

    }
}
